import type { Component } from 'vue'
import type { RouteRecordRaw } from 'vue-router'

function Layout(): Component {
  return import('@/layouts/index.vue')
}

const routes: RouteRecordRaw = {
  path: '/baseInfo',
  component: Layout,
  redirect: '/baseInfo/page', // 添加重定向
  name: 'baseInfoManagement',
  meta: {
    title: '基础信息',
    icon: 'i-ep:tools',
    hidden: true,
  },
  children: [
    {
      path: 'roleInfo',
      component: () => import('@/views/baseInfo/roleInfo.vue'),
      name: 'roleInfo',
      meta: {
        title: '角色管理',
        activeMenu: '/baseInfo/page',
      },
    },
    {
      path: 'rightInfo',
      component: () => import('@/views/baseInfo/authInfo.vue'),
      name: 'rightInfo',
      meta: {
        title: '权限管理',
        activeMenu: '/baseInfo/page',
      },
    },
    {
      path: 'userInfo',
      component: () => import('@/views/baseInfo/userInfo.vue'),
      name: 'userInfo',
      meta: {
        title: '用户管理',
        activeMenu: '/baseInfo/page',
      },
    },
    {
      path: 'productCategoryManagement',
      component: () => import('@/views/baseInfo/productCategory.vue'),
      name: 'productCategoryManagement',
      meta: {
        title: '商品类别管理',
        activeMenu: '/baseInfo/page',
      },
    },
    {
      path: 'productManagement',
      component: () => import('@/views/baseInfo/productInfo.vue'),
      name: 'productManagement',
      meta: {
        title: '商品管理',
        activeMenu: '/baseInfo/page',
      },
    },
    {
      path: 'supplierManagement',
      component: () => import('@/views/baseInfo/supplierInfo.vue'),
      name: 'supplierManagement',
      meta: {
        title: '供应商管理',
        activeMenu: '/baseInfo/page',
      },
    },
    {
      path: 'warehouseManagement',
      component: () => import('@/views/baseInfo/warehouseInfo.vue'),
      name: 'warehouseManagement',
      meta: {
        title: '仓库管理',
        activeMenu: '/baseInfo/page',
      },
    },
  ],
}

export default routes
